using System;
using System.Web.UI;

namespace MONA.Modules.Marketing.Controls
{
    public partial class Employee : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string[] characters = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "X", "All" };
                dlCharacters.DataSource = characters;
                dlCharacters.DataBind();
            }
        }

       

        protected void btnAddNewEmployee_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Default.aspx?page=AddEditEmployee&returnUrl=" + Server.UrlEncode(Request.RawUrl));
        }

        protected void dlCharacters_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                if (e.CommandArgument.ToString().Equals("All")) 
                    sdsEmployee.SelectParameters["LoginID"].DefaultValue = "%";
                else
                    sdsEmployee.SelectParameters["LoginID"].DefaultValue = e.CommandArgument.ToString();

                /*
                StringBuilder query = new StringBuilder();
                if (e.CommandArgument.ToString().Equals("All"))
                {
                    query.Append("([Name] LIKE '%')");
                }
                else
                {
                    query.AppendFormat("([Name] LIKE '{0}%')", e.CommandArgument.ToString());
                }
                odsUsers.SelectParameters[0].DefaultValue = query.ToString();
                */
            }
        }

    }
}